using System;
using System.Collections.Generic;
using System.Text;
using Weazel.Math;

namespace Weazel.Gezel.Simulator.Reference.Profiling
{
    class ProfilingOperation
    {
        Integer v;
        Integer vand;
        Integer vxor;
        bool upedgeMode;

        internal uint evals;
        internal uint toggles;

        public ProfilingOperation(bool upedgeMode, int width)
        {
            v = new Integer(width, 0, false);
            vand = new Integer(width, 0, false);
            vxor = new Integer(width, 0, false);
            evals = toggles = 0;
            this.upedgeMode = upedgeMode;
        }

        internal void HammingUpdate(Integer newValue, List<uint> weights)
        {
            evals++;

            if (weights.Count == 0)
            {
                if (upedgeMode)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    toggles += v.HammingDistanceTo(newValue);
                }
            }
            else
                throw new NotImplementedException("Weighted toggle counts are not implemented");

            v.ValueCopy(newValue);
        }
    }
}
